 <%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<html>
<head>
</head>
<script type="text/javascript">
	$(function(){
		$("#formID").validationEngine({
			showOnMouseOver : true
		});
		if("${userInfo}"){
			$("#userName").attr("disabled","disabled");
			$("#userName").attr("class","text");
		}
		if("${userInfo.sex}"=='男')$("input[name=sex]")[0].checked=true;
		else if("${userInfo.sex}"=='女')$("input[name=sex]")[1].checked=true;
		$("#btn_save").click(function(){
			var valid = $("#formID").validationEngine('validate');
			if(!valid)
				return;
			var frm = $("form[name='userInfoForm']");
			frm.attr("action", "${ctx}/userInfoController.do?method=save");
			submit(frm,function(res,status){
				win.window("close");
				if(isSuccess(res,status)){
					grid.datagrid("reload");
					showTip(alertinfo+"成功");
				}else showTip(alertinfo+"失败");
			},function(res,status){
				win.window("close");
				showTip(alertinfo+"失败");
			});
		});
		$("#btn_back").click(function(){
			win.window("close");
		});
	});
	
</script>
<body>
	<form action="/userInfoController" method="post" name="userInfoForm" id="formID">
		<c:if test="${userInfo!=null}">
			<input type="hidden" name="userid" value="${userInfo.userid}"/>
		</c:if>
		<div>
			<table class="FormView" border="0" cellspacing="1" cellpadding="0">
				<col class="Label" />
				<col class="Data" />
				<tr>
					<td>登陆名：</td>
					<td><input type="text" name="userName" id="userName" class="validate[required,maxSize[20],ajax[ajaxNameText]] text" value="${userInfo.userName}"/><font color="red">**</font></td> 
				</tr>
				<tr>
					<td>姓名：</td>
					<td><input type="text" name="userNote" id="userNote" class="validate[required,maxSize[10]] text" value="${userInfo.userNote}"/><font color="red">**</font></td>
				</tr>
				<tr>
					<td>性别：</td>
					<td><input type="radio" name="sex" value="男" checked="checked"/>男<input type="radio" name="sex" value="女"/>女</td> 
				</tr>
				<tr>
					<td>联系方式：</td>
					<td><input type="text" name="phone" id="phone" class="validate[required,maxSize[11],custom[mobile]] text" value="${userInfo.phone }"/><font color="red">**</font></td> 
				</tr>
				<tr>
					<td>所在班级：</td>
					<td><input type="text" name="userClass" id="userClass" class="validate[maxSize[10]] text" value="${userInfo.userClass }"/></td> 
				</tr>
			</table>
		</div>
	</form>
	<div align="center" class="foot-buttons""
			border="false" align="center">
			<div class="tool-btn" id="btn_save">
				<span class="icon-save">&nbsp;</span>
				保存
			</div>
			<div class="tool-btn" id="btn_back">
				<span class="icon-back">&nbsp;</span>
				返回
			</div>
	</div>
</body>
</html>
